Union Mount
   HOME

TheInfoList



OR:

In
computer A computer is a machine that can be programmed to Execution (computing), carry out sequences of arithmetic or logical operations (computation) automatically. Modern digital electronic computers can perform generic sets of operations known as C ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s, union mounting is a way of combining multiple directories into one that appears to contain their combined contents. Union mounting is supported in
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
,
BSD The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
and several of its successors, and Plan 9, with similar but subtly different behavior. As an example application of union mounting, consider the need to update the information contained on a
CD-ROM A CD-ROM (, compact disc read-only memory) is a type of read-only memory consisting of a pre-pressed optical compact disc that contains data. Computers can read—but not write or erase—CD-ROMs. Some CDs, called enhanced CDs, hold both comput ...
or
DVD The DVD (common abbreviation for Digital Video Disc or Digital Versatile Disc) is a digital optical disc data storage format. It was invented and developed in 1995 and first released on November 1, 1996, in Japan. The medium can store any kin ...
. While a CD-ROM is not writable, one can overlay the CD's
mount point Mounting is a process by which a computer's operating system makes files and directories on a storage device (such as hard drive, CD-ROM, or network share) available for users to access via the computer's file system. In general, the process o ...
with a writable directory in a union mount. Then, updating files in the union directory will cause them to end up in the writable directory, giving the illusion that the CD-ROM's contents have been updated.


Implementations


Plan 9

In the Plan 9 operating system from
Bell Labs Nokia Bell Labs, originally named Bell Telephone Laboratories (1925–1984), then AT&T Bell Laboratories (1984–1996) and Bell Labs Innovations (1996–2007), is an American industrial research and scientific development company owned by mult ...
(mid-1980s onward), union mounting is a central concept, replacing several older
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
conventions with union directories; for example, several directories containing
executables In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a data file ...
, unioned together at a single directory, replace the variable for command lookup in the shell. Plan 9 union semantics are greatly simplified compared to the implementations for
POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
-style operating systems: the union of two directories is simply the concatenation of their contents, so a directory listing of the union may display duplicate names. Also, no effort is made to recursively merge subdirectories, leading to an extremely simple implementation. Directories are unioned in a controllable order; , where is a union directory, denotes the file called in the first constituent directory that contains such a file.


Unix and BSD

Unix/POSIX implementations of unions have different requirements from the Plan 9 implementation due to constraints in the traditional Unix file system behavior, which greatly complicates their implementation and often leads to compromises. Problems that union mounting on Unix-like operating systems encounters include: * Duplicate file names within a directory are not acceptable, since this would break applications' expectations of how a Unix file system works. Putting a logical,
stack Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
-like precedence ordering on the union's constituents partially solves this problem, but requires memory to record which files need to be skipped over during a directory listing (which is otherwise a nearly stateless operation). * Deletion requires special support: if files with the same name exist in several of the union directory's constituents, simply deleting it from one of the constituents causes a file from one of the others to reappear in its stead. * Insertion of a directory into the stack can cause incoherency in the
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learnin ...
's file name cache. * Renaming a file within a single mounted file system (using the system call) should be an
atomic operation In concurrent programming, an operation (or set of operations) is linearizable if it consists of an ordered list of invocation and response events (event), that may be extended by adding response events such that: # The extended list can be re-e ...
, but renaming within a union mount can require changes to multiple of the union's constituent directories. A possible solution is to disallow in such situations and require implementations to copy-and-delete instead. * Stable
inode The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data. File-system object attribute ...
numbers for files,
hard link In computing, a hard link is a directory entry (in a directory-based file system) that associates a name with a file. Thus, each file must have at least one hard link. Creating additional hard links for a file makes the contents of that file acc ...
s and
memory-mapped I/O Memory-mapped I/O (MMIO) and port-mapped I/O (PMIO) are two complementary methods of performing input/output (I/O) between the central processing unit (CPU) and peripheral devices in a computer. An alternative approach is using dedicated I/O pro ...
() are hard to implement correctly. Early attempts to add unioning to Unix filesystems included the 3-d filesystem (
Bell Labs Nokia Bell Labs, originally named Bell Telephone Laboratories (1925–1984), then AT&T Bell Laboratories (1984–1996) and Bell Labs Innovations (1996–2007), is an American industrial research and scientific development company owned by mult ...
) and the Translucent File Service in
SunOS SunOS is a Unix-branded operating system developed by Sun Microsystems for their workstation and server computer systems. The ''SunOS'' name is usually only used to refer to versions 1.0 to 4.1.4, which were based on BSD, while versions 5.0 and l ...
(
Sun Microsystems Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
, 1988). An implementation of union mounting was added to the BSD version of Unix in version 4.4 (1994), taking inspiration from these earlier attempts, Plan 9 and the stackable file systems in
Spring Spring(s) may refer to: Common uses * Spring (season), a season of the year * Spring (device), a mechanical device that stores energy * Spring (hydrology), a natural source of water * Spring (mathematics), a geometric surface in the shape of a ...
(Sun, 1994). 4.4BSD implements the stack-of-directories approach outlined above. As in Plan 9, operations traverse this stack top-down to resolve names, but unlike Plan 9, BSD union mounts are recursive, so that the contents of subdirectories appear merged in the union directory. Also unlike the Plan 9 version, all layers except the top are read-only: modifying files in the union causes their contents to first be copied into the top layer of the stack, where the modifications are then applied. Deletion of files is implemented by writing a special type of file called a ''whiteout'' to the top directory, which has the effect of marking the file name as non-existent and hiding files with the same name in the lower layers of the stack. Whiteouts require support from the underlying file system.


Linux

Union mounting was implemented for Linux 0.99 in 1993; this initial implementation was called the Inheriting File System, but was abandoned by its developer because of its complexity. The next major implementation was
UnionFS Unionfs is a filesystem service for Linux, FreeBSD and NetBSD which implements a union mount for other file systems. It allows files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coher ...
, which grew out of the
FiST A fist is the shape of a hand when the fingers are bent inward against the palm and held there tightly. To make or clench a fist is to fold the fingers tightly into the center of the palm and then to clamp the thumb over the middle phalanges; in ...
project at
Stony Brook University Stony Brook University (SBU), officially the State University of New York at Stony Brook, is a public research university in Stony Brook, New York. Along with the University at Buffalo, it is one of the State University of New York system's ...
. An attempt to replace UnionFS,
aufs aufs (short for advanced multi-layered unification filesystem) implements a union mount for Linux file systems. The name originally stood for AnotherUnionFS until version 2. Developed by Junjiro Okajima in 2006, aufs is a complete rewrite of t ...
, was released in 2006, followed in 2009 by
OverlayFS In computing, OverlayFS is a union mount filesystem implementation for Linux. It combines multiple different underlying mount points into one, resulting in single directory structure that contains underlying files and sub-directories from all sou ...
. In 2014
OverlayFS In computing, OverlayFS is a union mount filesystem implementation for Linux. It combines multiple different underlying mount points into one, resulting in single directory structure that contains underlying files and sub-directories from all sou ...
union mount implementation was added to the standard
Linux kernel The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
source code. Similarly,
GlusterFS Gluster Inc. (formerly known as Z RESEARCH) was a software company that provided an open source platform for scale-out public and private cloud storage. The company was privately funded and headquartered in Sunnyvale, California, with an engineer ...
offers the ability to mount different filesystems distributed across a network, rather than being located on the same machine. MergerFS, originally released in 2014, is an actively developed open-source FUSE plugin, allowing pooling of arbitrary directories.


References

{{reflist, refs= {{Cite journal, title=Union Mounts in 4.4BSD-Lite, journal=Proceedings of the USENIX Technical Conference on UNIX and Advanced Computing Systems, date=December 1995, first=Jan-Simon, last=
Pendry Pendry is the surname of: * Joe Pendry (born August 5, 1947), American football coach * John Pendry (born 4 July 1943), English theoretical physicist * John Pendry (hang glider pilot) (born 1957) * Tom Pendry, Baron Pendry (1934–2023), English pol ...
, author2=
Marshall Kirk McKusick Marshall Kirk McKusick (born January 19, 1954) is a computer scientist, known for his extensive work on BSD UNIX, from the 1980s to FreeBSD in the present day. He was president of the USENIX Association from 1990 to 1992 and again from 2002 ...
, pages=25–33, url=http://www.usenix.org/publications/library/proceedings/neworl/full_papers/mckusick.a, access-date=25 November 2007
{{Cite journal, title=Versatility and Unix Semantics in a Fan-Out Unification File System, journal=Stony Brook University Technical Report FSL-04-01b, first=Charles P., last=Wauthor2=Jay Dave , author3=Puja Gupta , author4=Harikesavan Krishnan , author5=Erez Zadok , author6=Mohammad Nayyer Zubair , url=http://www.filesystems.org/docs/unionfs-tr/index.html, access-date=25 November 2007 {{Cite journal, title=Unioning file systems: Architecture, features, and design choices, website=LWN.net, date=March 2009, first=Valerie, last=Aurora, author2=Henson , url=https://lwn.net/Articles/324291/, access-date=21 December 2009 {{Cite journal, title=Union file systems: Implementations, part I, website=LWN.net, date=March 2009, first=Valerie, last=Aurora, author2=Henson , url=https://lwn.net/Articles/325369/, access-date=21 December 2009 {{Cite journal, title=Unioning file systems: Implementations, part 2, website=LWN.net, date=April 2009, first=Valerie, last=Aurora, author2=Henson , url=https://lwn.net/Articles/327738/, access-date=21 December 2009 {{Cite journal, title=About GlusterFS, date=November 2009, url=http://www.gluster.org/about/, access-date=4 March 2013